package com.vs.meepet.network;

import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;

/**
 * OkHttp初始化配置
 */
public class HttpConfig {
    private static OkHttpClient mOkHttpClient;

    public static OkHttpClient getOkHttpClient() {
        if (mOkHttpClient == null) {
            mOkHttpClient = initHttpClient();
        }
        return mOkHttpClient;
    }

    private static OkHttpClient initHttpClient() {
        if (mOkHttpClient == null) {
            OkHttpClient.Builder builder = new OkHttpClient.Builder()
                    .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                    .readTimeout(10000L, TimeUnit.MILLISECONDS)
                    .writeTimeout(600000L, TimeUnit.MILLISECONDS);
            //builder.addInterceptor(new HttpHeaderInterceptor());
            mOkHttpClient = builder.build();
        }
        return mOkHttpClient;
    }

}
